home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / accessibility / AccImpl.as next >
Text File  |  2014-03-27  |  4KB  |  134 lines

  1. package mx.accessibility
  2. {
  3.    import flash.accessibility.Accessibility;
  4.    import flash.accessibility.AccessibilityImplementation;
  5.    import flash.accessibility.AccessibilityProperties;
  6.    import flash.events.Event;
  7.    import mx.core.UIComponent;
  8.    import mx.core.mx_internal;
  9.    
  10.    use namespace mx_internal;
  11.    
  12.    public class AccImpl extends AccessibilityImplementation
  13.    {
  14.       
  15.       private static const STATE_SYSTEM_NORMAL:uint = 0;
  16.       
  17.       private static const STATE_SYSTEM_UNAVAILABLE:uint = 1;
  18.       
  19.       private static const STATE_SYSTEM_FOCUSABLE:uint = 1048576;
  20.       
  21.       private static const STATE_SYSTEM_FOCUSED:uint = 4;
  22.       
  23.       private static const EVENT_OBJECT_NAMECHANGE:uint = 32780;
  24.       
  25.       mx_internal static const VERSION:String = "3.0.0.0";
  26.        
  27.       
  28.       protected var master:UIComponent;
  29.       
  30.       protected var role:uint;
  31.       
  32.       public function AccImpl(param1:UIComponent)
  33.       {
  34.          var _loc3_:int = 0;
  35.          var _loc4_:int = 0;
  36.          super();
  37.          this.master = param1;
  38.          stub = false;
  39.          param1.accessibilityProperties = new AccessibilityProperties();
  40.          var _loc2_:Array = eventsToHandle;
  41.          if(_loc2_)
  42.          {
  43.             _loc3_ = _loc2_.length;
  44.             _loc4_ = 0;
  45.             while(_loc4_ < _loc3_)
  46.             {
  47.                param1.addEventListener(_loc2_[_loc4_],eventHandler);
  48.                _loc4_++;
  49.             }
  50.          }
  51.       }
  52.       
  53.       mx_internal static function createAccessibilityImplementation(param1:UIComponent) : void
  54.       {
  55.       }
  56.       
  57.       public static function enableAccessibility() : void
  58.       {
  59.       }
  60.       
  61.       protected function eventHandler(param1:Event) : void
  62.       {
  63.          switch(param1.type)
  64.          {
  65.             case "errorStringChanged":
  66.                Accessibility.sendEvent(master,0,EVENT_OBJECT_NAMECHANGE);
  67.                Accessibility.updateProperties();
  68.                break;
  69.             case "toolTipChanged":
  70.                Accessibility.sendEvent(master,0,EVENT_OBJECT_NAMECHANGE);
  71.                Accessibility.updateProperties();
  72.          }
  73.       }
  74.       
  75.       protected function getName(param1:uint) : String
  76.       {
  77.          return null;
  78.       }
  79.       
  80.       private function getStatusName() : String
  81.       {
  82.          var _loc1_:String = "";
  83.          if(master.toolTip)
  84.          {
  85.             _loc1_ += " " + master.toolTip;
  86.          }
  87.          if(master is UIComponent && UIComponent(master).errorString)
  88.          {
  89.             _loc1_ += " " + UIComponent(master).errorString;
  90.          }
  91.          return _loc1_;
  92.       }
  93.       
  94.       override public function get_accName(param1:uint) : String
  95.       {
  96.          var _loc2_:String = UIComponentAccImpl.getFormName(master);
  97.          if(param1 == 0 && master.accessibilityProperties && master.accessibilityProperties.name && master.accessibilityProperties.name != "")
  98.          {
  99.             _loc2_ += master.accessibilityProperties.name + " ";
  100.          }
  101.          _loc2_ += getName(param1) + getStatusName();
  102.          return _loc2_ != null && _loc2_ != "" ? _loc2_ : null;
  103.       }
  104.       
  105.       protected function get eventsToHandle() : Array
  106.       {
  107.          return ["errorStringChanged","toolTipChanged"];
  108.       }
  109.       
  110.       protected function getState(param1:uint) : uint
  111.       {
  112.          var _loc2_:uint = STATE_SYSTEM_NORMAL;
  113.          if(!UIComponent(master).enabled)
  114.          {
  115.             _loc2_ |= STATE_SYSTEM_UNAVAILABLE;
  116.          }
  117.          else
  118.          {
  119.             _loc2_ |= STATE_SYSTEM_FOCUSABLE;
  120.             if(UIComponent(master) == UIComponent(master).getFocus())
  121.             {
  122.                _loc2_ |= STATE_SYSTEM_FOCUSED;
  123.             }
  124.          }
  125.          return _loc2_;
  126.       }
  127.       
  128.       override public function get_accRole(param1:uint) : uint
  129.       {
  130.          return role;
  131.       }
  132.    }
  133. }
  134.